<?php require_once('../../core/import.php');?>
<?php User::Permission('ROLE_UPDATE'); ?>
<?php
    if($_SERVER['REQUEST_METHOD']=='POST')
    {
		
		//exit($PassWords);
        #添加数据
		$Name=Functions::FormArgs('Name');
		$Modular=Functions::FormArgs('Modular');
		$is_i=Functions::FormArgs('is_i');
		$Modulars='';
		$Functions='';
		if(count($Modular)>0){
			foreach($Modular as $Value){
				$Modulars.=$Value.',';	
			}
		}
		for($j=0;$j<$is_i;$j++){
			$Function=Functions::FormArgs('Function_'.$j);
			if(count($Function)>0){
				foreach($Function as $Value){
					$Functions.=$Value.',';	
				}
			}
		}
		$Permissions=$Modulars.$Functions;
		$Data=array(
			'Name'=>$Name,
			'Permissions'=>$Permissions
		);

        DB::UpdateRowByID('management_user_role',Functions::FormArgs('ID'),$Data);
        echo '{"Number":"0","Description":"成功执行"}';
    }
?>